Skip to content

Take a known control function offline on its Cannot Claim - #982

Open
gunicsba wants to merge 1 commit into
Open-Agriculture:mainfrom
gunicsba:fix/cannot-claim-known-cf
Open

gunicsba wants to merge 1 commit into
Open-Agriculture:mainfrom
gunicsba:fix/cannot-claim-known-cf

Conversation

@gunicsba

Copy link
Copy Markdown
Member

Fixes #955, reported by @sujandumaru.

A Cannot Claim (an address claim from the null address, 254) from a control function we already tracked was ignored. The control function stayed online at its old address, and the application got no event.

ISO 11783-5:2019 4.5.3: "A CF that has previously communicated with another CF unable to claim a particular address shall be capable of detecting when that other CF has been "disabled" by monitoring its cannot-claim-source-address message as well as the address-claimed message of the higher-priority CF that impeded the claim."

The winner's claim already handled the second case. The new process_cannot_claim() handles the first:

  • It looks up the NAME among the control functions in the address table on that channel. The null address is never used as an index.
  • It takes a match offline the same way as one that stops answering requests for address claim: the CF moves to the inactive list, its address becomes the null address, and the Offline event fires after the lock is released.
  • A partner that goes offline this way can take over a matching device that is already online, the same as after a missed request.
  • Our own control functions are skipped, since they handle their own claims. A Cannot Claim from an unknown NAME, or from a CF that is already inactive, still changes nothing. The existing Cannot Claim tests from Bound address claim handling and fix commanded address checks #947 still pass.

Tests:

  • CannotClaimTakesAKnownControlFunctionOffline checks the Offline event, and that the same CF comes back online when it claims again.
  • CannotClaimTakesAPartnerOffline
  • CannotClaimFromAnUnknownNameChangesNothing

🤖 Generated with Claude Code

A Cannot Claim from a control function in the address table was
ignored, so it stayed online at its old address. It now goes offline
the same way as one that stops answering requests for address claim
(ISO 11783-5:2019 4.5.3).

Fixes Open-Agriculture#955

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cannot Claim from a control function we already know leaves it online at its old address

1 participant